package com.wx.entity;

import com.wx.common.BaseEntity;
import com.wx.common.CreateValidate;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;

@Data
@Table(name = "sys_user")
@ApiModel(value = "sysUser")
public class SysUser extends BaseEntity implements Serializable {

	private static final long serialVersionUID = -7949293189884985414L;
	/**
	 * 用户名
	 */
	@Column(name = "user_name")
	@Length(min = 2, max = 32, message = "{user.userName.length}")
	@ApiModelProperty(value = "用户名")
	private String userName;

	/**
	 * 密码
	 */
	@Column(name = "password")
	@NotEmpty(message = "密码不能为空", groups = {CreateValidate.class})
	@ApiModelProperty(value = "密码")
	private String password;

	/**
	 * 真实姓名
	 */
	@Column(name = "real_name")
	@Length(min = 1, max = 32, message = "支持1到32个字符")
	@ApiModelProperty(value = "真实姓名")
	private String realName;
	/**
	 * 性别
	 */
	@Column(name = "sex")
	@NotEmpty(message = "性别不能为空")
	@ApiModelProperty(value = "性别")
	private String sex;

	/**
	 * 手机号
	 */
	@Column(name = "mobile")
	@ApiModelProperty(value = "手机号")
	private String mobile;
	/**
	 * 邮箱
	 */
	@Column(name = "email")
	@ApiModelProperty(value = "邮箱")
	private String email;

	/**
	 * 省
	 */
	@Column(name = "province")
	@ApiModelProperty(value = "省编码")
	private String province;

	/**
	 * 城市
	 */
	@Column(name = "city")
	@ApiModelProperty(value = "城市编码")
	private String city;

	/**
	 * 国家
	 */
	@Column(name = "area")
	@ApiModelProperty(value = "区县编码")
	private String area;

	/**
	 * 状态
	 */
	@Column(name = "status")
	private Integer status;

	/**
	 * 头像
	 */
	@Column(name = "avatar")
	@ApiModelProperty(value = "头像")
	private String avatar;

	/**
	 * 省份名称
	 */
	@ApiModelProperty(value = "省份名称")
	@Transient
	private String provinceName;

	/**
	 * 城市
	 */
	@ApiModelProperty(value = "城市名称")
	@Transient
	private String cityName;

	/**
	 * 区县
	 */
	@ApiModelProperty(value = "区县名称")
	@Transient
	private String areaName;


}